home *** CD-ROM | disk | FTP | other *** search
/ JCSM Shareware Collection 1996 September / JCSM Shareware Collection (JCS Distribution) (September 1996).ISO / prgtools / njsdk30.zip / NJSDK.TXT < prev    next >
Text File  |  1994-03-20  |  36KB  |  892 lines

  1.  
  2.          NN      NN     JJJJJJ   SSSSSSSS DDDDDDDD   KK      KK (TM)
  3.          NN      NN       JJ   SS         DD      DD KK    KK
  4.          NNNN    NN       JJ   SS         DD      DD KK  KK
  5.          NN  NN  NN       JJ     SSSSSS   DD      DD KKKK
  6.          NN    NNNN       JJ           SS DD      DD KK  KK
  7.          NN      NN JJ    JJ           SS DD      DD KK    KK
  8.          NN      NN   JJJJ     SSSSSSSS   DDDDDDDD   KK      KK
  9.  
  10.                               NJSDK (tm)
  11.  
  12.              NJStar Chinese Software Development Kits v3.0
  13.         Copyright (c) Hongbo Ni 1992-1994. All Rights Reserved
  14.  
  15.  
  16.         Hongbo Data Systems
  17.         P.O. Box 40                    Telephone:  +61-2-869-0821
  18.         Epping NSW 2121                Fax:        +61-2-869-0823
  19.         AUSTRALIA                      Compuserve: 100032,2724
  20. ___________________________________________________________________________
  21.  
  22. 1. Introduction
  23. ============================================================================
  24.  
  25. NJSDK is a C Library based on NJSTAR Version 3.0. It contains  all  the
  26. functions for handling Chinese input, display and printing. With NJSDK, user
  27. can develop any Chinese applications without knowing how Chinese  characters
  28. are inputed, displayed or printed. It is  as  easy  as  writing  an  English
  29. program.
  30.  
  31. NJSDK provides a Chinese interface for any C program. It reserves the bottom
  32. line for Chinese input, and all other 24 lines (on VGA, 18  on  EGA,  29  on
  33. SVGA) are working area for the application. NJSDK starts by loading  Chinese
  34. font and dictionaries into memory, which require 200KB. If  user  select  to
  35. leave font on disk, then NJSDK only requires 80KB  to  operate.  When  NJSDK
  36. exits, all used memory are released, and screen is back to text mode.
  37.  
  38. NJSDK supports all the input methods in NJSTAR v3.0,  user  defined  methods
  39. also supported in the same way as in NJSTAR. ALT+Function Keys are  reserved
  40. by NJSDK for switching between the Chinese input methods (as listed in  next
  41. section), and other Chinese related function.
  42.  
  43. Mouse operations are directly supported by NJSDK,  application  program  can
  44. get mouse position by calling the NJSDK mouse functions.
  45.  
  46. Screen Saver and AutoSave  facilities  have  been  built  in  NJSDK.  Active
  47. interval can be set by a configuration program NJSDKCFG.EXE.
  48.  
  49. 2. License Information
  50. ============================================================================
  51.  
  52. With the full payment for NJSDK, the developer are  granted  a  distribution
  53. license which permits the distribution of all NJSTAR  dictionaries,  drivers
  54. and fonts (total 30  files)  with  their  application  without  any  further
  55. royalty payment. Distribution of any Executable file (*.EXE)  of  NJSTAR  is
  56. strictly prohibited. Each licensed copy has an unique  serial  number,  this
  57. protects any illegal use of NJSDK by other un-licensed users. Licensed  user
  58. are entitled a free upgrade  to  next  version  of  NJSDK  when  it  becomes
  59. available.  Please contact the author for current price.  Please contact the
  60. author if you or your company have any special requirements or cooperations.
  61.  
  62.                               LIMITED WARRANTY
  63.  
  64. A)   The Author  of NJSDK warrants  that all disks provided  are free from
  65.      defects in material and workmanship, assuming normal use, for a period
  66.      of 30 days from the date of purchase.
  67.  
  68. B)   The  Author  of NJSDK  warrants  that  the  program will  perform  in
  69.      substantial  compliance with  the documentation  supplied  within this
  70.      document.    If a  significant  defect in  the  product is  found, the
  71.      Purchaser may return the product for a  refund.  In no event will such
  72.      a refund exceed the purchase price of the product.
  73.  
  74. C)   Use of this product for any period of time constitutes your acceptance
  75.      of this agreement and subjects you to its contents.
  76.  
  77. D)   EXCEPT  AS  PROVIDED  ABOVE,  THE   AUTHOR   OF  NJSDK  DISCLAIMS  ALL
  78.      WARRANTIES, EITHER EXPRESS OR  IMPLIED, INCLUDING, BUT NOT  LIMITED TO
  79.      IMPLIED WARRANTIES  OF MERCHANTABILITY  AND FITNESS  FOR A  PARTICULAR
  80.      PURPOSE,  WITH RESPECT  TO  THE  PRODUCT.   SHOULD  THE PROGRAM  PROVE
  81.      DEFECTIVE, THE PURCHASER ASSUMES THE RISK OF PAYING THE ENTIRE COST OF
  82.      ALL NECESSARY SERVICING,  REPAIR, OR CORRECTION AND  ANY INCIDENTAL OR
  83.      CONSEQUENTIAL DAMAGES.  IN NO  EVENT WILL THE  AUTHOR   OF   NJSDK BE
  84.      LIABLE  FOR  ANY  DAMAGES  WHATSOEVER  (INCLUDING  WITHOUT  LIMITATION
  85.      DAMAGES FOR LOSS OF  BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS  OF
  86.      BUSINESS INFORMATION  AND  THE LIKE)  ARISING OUT  OF THE  USE OR  THE
  87.      INABILITY TO USE THIS  PRODUCT EVEN IF THE AUTHOR HAS  BEEN ADVISED OF
  88.      THE POSSIBILITY OF SUCH DAMAGES.
  89.  
  90.  
  91. 3. List of files in NJSDK package
  92. ============================================================================
  93.  
  94.         NJSDK.LIB       The NJSDK C subroutine library (MSC 7.0 Large model)
  95.         NJSDK.H         The header file for NJSDK
  96.         KEYS.H          The header file for key and mouse button definitions
  97.         ******.C        Example programs
  98.         CC.BAT          Batch file used to compile program, eg.  CC hello
  99.         NJSDK.DOC       NJSDK user manual in MS-Word 2.0 for Win. Format
  100.         NJSDK.TXT       Text version of NJSDK.DOC
  101.         NJSDK.INI       Tell NJSDK where are the NJSTAR dictionaries & font
  102.         NJSDK.CFG       NJSDK configuration file
  103.         NJSDKCFG.EXE    The application configuration program
  104.         SUPER.VGA       The super VGA definition file (required by NJSDKCFG)
  105.  
  106. Following files from NJSTAR are needed for program based on  NJSDK  to  run.
  107. Those files can be distributed with user's .EXE file  only  after  a  proper
  108. distribution license has been purchased.
  109.  
  110.         CCLIB.16        16x16 Simplified Chinese bitmap
  111.         CCLIB.24        24x24 Simplified Chinese bitmap (With Reg. ver)
  112.         CCLIBF.16       16x16 un-Simplified Chinese bitmap
  113.         CCLIBF.24       24x24 un-Simplified Chinese bitmap (With Reg. ver)
  114.         ASCII.16        16x8 Ascii bitmap
  115.         ASCII.24        24x12 Ascii bitmap
  116.  
  117.         NANJIPY.DIC      NJSTAR PinYin dictionary
  118.         NANJILX.DIC     NJSTAR Lianxiang dictionary
  119.         NJINPUT*.DIC    External character input methods dictionary
  120.         NJCIZU*.DIC     External word input methods dictionary
  121.         TOLERATE.DIC    PinYin Tolerance lists (text file)
  122.         ********.DRV    Printer drivers
  123.  
  124. If NJSTAR is installed on C:\NJSTAR, a file NJSDK.INI can be created in
  125. the same directory as user's application. It should contains two lines:
  126.  
  127. NJDIC=C:\NJSTAR
  128. NJZK=C:\NJSTAR
  129.  
  130. NJSDK will try to locate the font and dictionaries in the same directory as
  131. users EXE file. If not found, NJSDK will try those as defined in NJSDK.INI.
  132. user can also set two DOS environment variables in AUTOEXEC.BAT to specify
  133. the location of fonts and dictionaries (override NJSDK.INI).
  134.  
  135. SET NJZK=C:\NJSTAR
  136. SET NJDIC=C:\NJSTAR
  137.  
  138. In this way, only one set of font and dictionaries are needed in one
  139. computer, all the NJSDK applications and NJSTAR can access the same font
  140. and dictionaries.
  141.  
  142.  
  143. 4. Function Keys Reserved by NJSDK
  144. ============================================================================
  145.  
  146.         Alt+F1  -  NJSDK Help           Alt+F9   -  Pure Chinese Input
  147.         Alt+F2  -  Other Input Methods  Alt+F10  -  FanTiZi or JianTiZi
  148.         Alt+F3  -  QuWeiMa Input        Alt+F11  -  Adding Character/Word
  149.         Alt+F4  -  GuoBiao Input        Alt+F12  -  Remove Character/Word
  150.         Alt+F5  -  PinYin Input
  151.         Alt+F6  -  ASCII Input          Alt+'X'  -  LianXiang
  152.         Alt+F7  -  ZhuYin Input         Alt+'Z'  -  Get PinYin/ Input Code
  153.         Alt+F8  -  Options              ESC      -  Cancel Current Input
  154.  
  155.  
  156. 5. List of NJSDK Functions
  157. ============================================================================
  158.  
  159. Function Name   Descriptions
  160. --------------  ------------------------------------------------------------
  161. NJ_AutoSave     Tell NJSDK which is your AutoSave function
  162. NJ_box          Draw a rectangle box in given color
  163. NJ_button       Select from a list of buttons
  164. NJ_clscolum     clear a column of text
  165. NJ_clsrows      clear rows of text
  166. NJ_cursorOnOff  turn on / off the blinking input cursor
  167. NJ_dialog       A dialog entry program
  168. NJ_end          end of NJSDK session (unload font and dictionaries)
  169. NJ_entry        entry input routine
  170. NJ_fillwin      fill a window with color
  171. NJ_fontsize     Change the size of Chinese characters.
  172. NJ_formfeed     Form Feed
  173. NJ_getinput     get current input method set by the user
  174. NJ_getkey       get the key pressed by user
  175. NJ_getmouse     get mouse position
  176. NJ_gets         get a string with Chinese characters
  177. NJ_gets0        get a string without Chinese characters
  178. NJ_init         Initialise NJSDK library (setup Graphics mode, load Chinese)
  179. NJ_line         Draw a horizontal or vertical line
  180. NJ_linefeed     Line feed
  181. NJ_menu         menu selection routine
  182. NJ_mousecursor  turn on /off the mouse cursor
  183. NJ_prt_end      end of the printing
  184. NJ_prt_init     Initialising printer
  185. NJ_prts         print a string to printer
  186. NJ_putc         put a English (ascii 1-255) to screen
  187. NJ_puts         put a string on screen (with or without Chinese Characters)
  188. NJ_setcursor    set cursor position
  189. NJ_setinput     set Chinese input Method
  190. NJ_setmargin    Set Margins and line spacing
  191. NJ_window       draw a window with color
  192.  
  193.  
  194.  
  195.  
  196. 6. Detailed Description of NJSDK functions
  197. ============================================================================
  198.  
  199. *       Initialization
  200. __________________________________________________________________________
  201.  
  202. NJ_init         Initialise NJSDK library, such as setup graphics mode, load
  203.                 Chinese font and dictionaries. This function must be called
  204.                 before any NJSDK function is used.
  205.  
  206. Calling Syntax: NJ_init(char *homedir)
  207. Input:          homedir - a char pointer points to the dir where application
  208.                 is started this is used for NJSDK to locate font and
  209.                 dictionaries
  210. Return:         0  - Initialisation OK
  211.                 -1 - Initialisation failed
  212. See also:       NJ_end
  213. Example:        
  214.         main(int argc, char **argv)
  215.         {
  216.                 NJ_init(argv[0]);
  217.                 ....
  218.                 ....
  219.                 NJ_end();
  220.         }
  221. __________________________________________________________________________
  222.  
  223. NJ_end          Exit NJSDK library, font and dictionaries are unloaded and
  224.                 screen are set back to text mode.
  225.  
  226. Calling Syntax: NJ_end()
  227. Input:          (none)
  228. Output:         (none)
  229. Return:         (none)
  230. See also:       NJ_init
  231. Example:        see NJ_init
  232. ___________________________________________________________________________
  233.  
  234. NJ_AutoSave     Tell NJSDK which is your AutoSave function
  235.  
  236. Calling Syntax: int NJ_AutoSave(int(*asfun)())
  237. Input:  int *asfun() -- a function pointer points to the user's
  238.         SaveSave Funcion.
  239. Output: (none)
  240. Example:
  241.         int myautosave()
  242.         {
  243.             /* Close the data base, or    */
  244.             /* do anything you like to do */
  245.         }
  246.  
  247.         main(int argc, char **argv)
  248.         {
  249.                 NJ_init(argv[0]);
  250.                 NJ_AutoSave(myautosave);
  251.                 ....
  252.                 ....
  253.                 NJ_end();
  254.         }
  255.  
  256. NOTE: User should call this function if Autosave features are needed, and do
  257.       any thing you want to do in it. such as backup data base. NJSDK will
  258.       call this  function in a preset interval or when any emergency happen.
  259.       a default function is provided by NJSDK, which does nothing.
  260. ____________________________________________________________________________
  261.  
  262. NJ_getvideo     Get Video screen parameters
  263.  
  264. Calling Syntax: int NJ_getvideo(struct NJVIDEO *njv)
  265. Input:          struct NJVIDEO *njv -- pointer to NJVIDEO structure
  266.  
  267.                 struct NJVIDEO {
  268.                   int Videomode;    /* Current Video Mode (see NJSDK.H)    */
  269.                   int Nrows;        /* number of rows EGA=18 VGA=24 SVGA=29*/
  270.                   int BytesPerLine; /* bytes per line EGA/VGA=80 SVGA=100  */
  271.                   int PixelsPerRow; /* Pixels per row EGA=18 VGA/SVGA=19   */
  272.                   int Mono;         /* Is a monochrome mornitor            */
  273.                 };
  274.  
  275. Output:         struct NJVIDEO *njv
  276.  
  277. See also:       NJ_init()
  278. Example:
  279.         #include "njsdk.h"
  280.         struct NJVIDEO njv;
  281.         main(int argc, char **argv)
  282.         {
  283.                 NJ_init(argv[0]);
  284.                 NJ_getvideo(&njv)
  285.  
  286.                 ....
  287.                 ....
  288.                 NJ_end();
  289.         }
  290. __________________________________________________________________________
  291.  
  292.  
  293. *       Keyboard and Mouse Input
  294. ___________________________________________________________________________
  295.  
  296. NJ_getkey       wait for user to press a key, and return the key values as
  297.                 defined in header file KEYS.H
  298.  
  299. Calling Syntax: NJ_getkey()
  300. Input:  (none)
  301. Output: (none)
  302. Return:         the key pressed (see KEYS.H for predefined value)
  303. See also:       NJ_getmouse()
  304. Example:        
  305.         #include "keys.h"
  306.         ....
  307.         k=NJ_getkey();
  308.         if(k==ESC) exit(0);
  309.         ....
  310. ___________________________________________________________________________
  311.  
  312. NJ_getmouse     report the current mouse position (row, column in pixels).
  313.  
  314. Calling Syntax: NJ_getmouse(int *row, int *col) 
  315. Input:          (none)
  316. Output:         int *row, *col -- the current mouse cursor position
  317. Return:         the key value if any key is pressed
  318. See also:       NJ_getkey()
  319. Example:        
  320.         int row, col;
  321.         NJ_getmouse(&row, &col);
  322.         sprintf(str,"mouse position: %d %d", row,col);
  323.         NJ_puts(str, 10,10,15);
  324. ___________________________________________________________________________
  325.  
  326. NJ_mousecursor  Turn on / off mouse cursor during screen outputs
  327.                  
  328. Calling Syntax: NJ_mousecursor(int on)
  329. Input:          on = 1 -- turn ON the mouse cursor
  330.                 on = 0 -- turn OFF the mouse cursor
  331. Output:         (none)
  332. Return:         (none)
  333. See also:       NJ_getmouse()
  334. Example:        
  335.         NJ_mousecursor(0);
  336.         NJ_puts(str, ...);
  337.         NJ_mousecursor(1);
  338.         ....
  339. ___________________________________________________________________________
  340.  
  341. NJ_cursorOnOff  turn ON / OFF the blinking input cursor
  342.  
  343. Calling Syntax: NJ_cursorOnOff(int on)
  344. Input:          on = 1 -- turn ON the cursor
  345.                 on = 0 -- turn OFF the cursor
  346. Output:         (none)
  347. Return:         (none)
  348. See also:       NJ_getkey()
  349. Example:        
  350.         NJ_cursorOnOff(1);
  351.         NJ_gets(str, ...);
  352.         NJ_cursorOnOff(0);
  353.         ....
  354. __________________________________________________________________________
  355.  
  356. NJ_setcursor    set the blinking cursor position
  357.  
  358. Calling Syntax: NJ_setcursor(int row, int col) 
  359. Input:          row, col  -- the new cursor position in character
  360.                              coordinate (25x80)
  361. Output:         (none)
  362. Return:         (none)
  363. See also:       NJ_cursorOnOff()
  364. Example:        
  365.         NJ_setcursor(24, 1);
  366. __________________________________________________________________________
  367.  
  368. NJ_gets get a string including Chinese characters from screen
  369.  
  370. Calling Syntax: int NJ_gets(char *str, int row, int col, int len, int 
  371.                 Fcolor, int Bcolor)
  372. Input:          str -- the buffer for holding the input string, minimum
  373.                         length = len.
  374.                 len -- the maximum len of input string
  375.                 row, col -- the screen position where input string starts
  376.                 Fcolor -- foreground color (0 - 15)
  377.                 Bcolor -- background color (0 - 15)
  378. Output:         str -- the string entered by user
  379. Return:         -1  -- user cancel the input by ESC
  380.                 0   -- user end the input by ENTER
  381.                 >0 -- other non-editing keys
  382. See also:       NJ_puts()
  383. Example:        
  384.         char str[80];
  385.         NJ_gets(str, 10,5, 70, 15, 1);
  386.         ....
  387. __________________________________________________________________________
  388.         
  389. NJ_gets0        Same as NJ_gets, except that Chinese input is not allowed
  390.                 in this function
  391. __________________________________________________________________________
  392.  
  393. NJ_setinput     set Chinese input method
  394.          
  395. Calling Syntax: int NJ_setinput(int method, char select)
  396. Input:          method =0 -- ascii input
  397.                         1 -- PinYin input
  398.                         2 -- QuWeiMa input
  399.                         3 -- GuoBiao Input
  400.                         4 -- Other inputs
  401.                         5 -- ZhuYin input
  402.                 select -- for select a sub-method if the method has multiple
  403.                           choose such as 4 and 5. Not used for methods 0-3.
  404. Output:         (none)
  405. Return:         (none)
  406. See also:       NJ_getinput()
  407. Example:        /* select WuBiZiXin method */
  408.                 NJ_setinput(4, 'B');
  409. ___________________________________________________________________________
  410.  
  411. NJ_getinput     get the current input method
  412.          
  413. Calling Syntax: int NJ_getinput(int *method, char *select)
  414. Input:          (none)
  415. Output:         method =0 -- ascii input
  416.                         1 -- PinYin input
  417.                         2 -- QuWeiMa input
  418.                         3 -- GuoBiao Input
  419.                         4 -- Other inputs
  420.                         5 -- ZhuYin input
  421.                 select -- for select a sub-method if the method has multiple
  422.                           choose such as 4 and 5. Not used for methods 0-3.
  423. Return:         (none)
  424. See also:       NJ_setinput()
  425. Example:        /* Find out current input method */
  426.                 int m, s,
  427.                 ...
  428.                 NJ_setinput(&m, &s);
  429.                 if(m==4 && s=='B'){
  430.                    // You are using Wu BI Zi Xin
  431.                    ...
  432.                 }
  433. ___________________________________________________________________________
  434.  
  435.  
  436. *       Screen Display
  437. __________________________________________________________________________
  438.  
  439. NJ_puts         Display a string of ascii, Chinese or mix of them on
  440.                 specific position of the screen with specific color.
  441. Calling Syntax: int NJ_puts(char str,int row,int col,int Fcolor,int Bcolor)
  442. Input:          str -- the string to display (ascii, Chinese or mix )
  443.                 row, col -- the screen position where the output starts
  444.                 Fcolor -- foreground color (0 - 15)
  445.                 Bcolor -- background color (0 - 15)
  446. Output:         (none)
  447. Return:         (none)
  448. See also:       NJ_gets()
  449. Example:        
  450.         /* display 'Chinese char' on 20,10 with Yellow on Red*/
  451.         NJ_puts("CHINESE Char", 20,10, 14,4);
  452.         .....
  453. __________________________________________________________________________
  454.  
  455. NJ_putc         Display a ascii character on specific position of the
  456.                 screen with color.
  457. Calling Syntax: int NJ_putc(char c,int row,int col,int Fcolor,int Bcolor)
  458. Input:          c -- the character to display (ascii 1-255)
  459.                 row, col -- the screen position where the output starts
  460.                 Fcolor -- foreground color (0 - 15)
  461.                 Bcolor -- background color (0 - 15)
  462. Output:         (none)
  463. Return:         (none)
  464. See also:       NJ_puts()
  465. Example:        
  466.         /* display 'A' on 20,10 with Yellow on Red*/
  467.         NJ_putc('A', 20,10, 14,4);
  468.         
  469. __________________________________________________________________________
  470.  
  471. NJ_window       Draw a outline window with specific color
  472.  
  473. Calling Syntax: int NJ_window(int r1, int c1, int h, int v, int color)
  474. Input:          r1, c1 -- upper left corner of the window (in pixels)
  475.                 h,  v  -- the Horizontal and vertical size of the
  476.                                 window (in pixels)
  477.                 color  -- the color of the screen
  478. Output:         (none)
  479. Return:         (none)
  480. See also:       NJ_fillwin()
  481. Example:        
  482.         NJ_window(50,100, 100, 400, 2);
  483.         ....
  484. __________________________________________________________________________
  485.  
  486. NJ_fillwin      Same as NJ_window, except not boarder outline
  487.  
  488. Calling Syntax: int NJ_fillwin(int r1, int c1, int h, int v, int color)
  489. Input:          r1, c1 -- upper left corner of the window (in pixels)
  490.                 h,  v  -- the Horizontal and vertical size of the
  491.                                 window (in pixels)
  492.                 color  -- the color of the screen
  493. Output:         (none)
  494. Return:         (none)
  495. See also:       NJ_window()
  496. Example:        
  497.         NJ_fillwin(50,100, 100, 400, 2);
  498.         ....
  499. __________________________________________________________________________
  500.  
  501. NJ_clscolum     Clear portion of the line with specified color
  502.  
  503. Calling Syntax: int NJ_clscolum(int row1, int col1, int col2, int color)
  504. Input:          row -- the line number
  505.                 col1 -- the start column number
  506.                 col2 -- the end column number
  507.                 color -- the color
  508. Output:         (none)
  509. Return:         (none)
  510. See also:       NJ_clsrows()
  511. Example:        
  512.         NJ_clscolum(1, 0,80, 15);
  513.         ....
  514. __________________________________________________________________________
  515.  
  516. NJ_clsrows      Clear number of lines
  517.  
  518. Calling Syntax: int NJ_clsrows(int row1, int row2, int color) 
  519. Input:          row1 -- the start line number
  520.                 row2 -- the end line number
  521.                 color -- the color
  522. Output:         (none)
  523. Return:         (none)
  524. See also:       NJ_clscolum()
  525. Example:        
  526.         NJ_clsrows(5,10, 15);
  527.         ....
  528. __________________________________________________________________________
  529.  
  530. NJ_line         Draw a horizontal or vertical line
  531.  
  532. Calling Syntax: int NJ_line(int row1, int col1, int row2, int col2, int color)
  533. Input:          row1 -- the start row in pixel
  534.                 col1  -- the start column in pixel
  535.                 row2 -- the end row in pixel
  536.                 col2  -- the end column in pixel
  537.                 color -- the line color
  538. Output:  (none)
  539. Return:  (none)
  540. See also:       NJ_box()
  541. Example:
  542.         NJ_line(5,0,5,640,15);
  543.         ....
  544. __________________________________________________________________________
  545.  
  546. NJ_box          Draw a rectangle box in given color
  547.  
  548. Calling Syntax: int NJ_line(int row1, int col1, int row2, int col2, int color)
  549. Input:          row1 -- the start row in pixel
  550.                 col1  -- the start column in pixel
  551.                 row2 -- the end row in pixel
  552.                 col2  -- the end column in pixel
  553.                 color -- the line color
  554. Output:  (none)
  555. Return:  (none)
  556. See also:       NJ_line()
  557. Example:
  558.         NJ_box(5,0,50,640,15);
  559.         ....
  560. __________________________________________________________________________
  561.  
  562. NJ_menu         Selecting a list of options by menu
  563.  
  564. Calling Syntax: int NJ_menu(int Fcolor1, int Bcolor1, int Fcolor2,int 
  565.                         Bcolor2,int pressed, struct MENU_S *sl,int ns,
  566.                         int ini,int(*msgfun)(char *))
  567.  
  568. Input:          Fcolor1, Bcolor1 -- the foreground and background color
  569.                                     of normal text
  570.                 Fcolor2, Bcolor2 -- the foreground and background color
  571.                                     of high lighted text (0 - 15).
  572.                 pressed=0 -- mouse cursor will move the selection item
  573.                              without press the mouse button
  574.                        =1 -- mouse cursor will move the selection item
  575.                              only if mouse button are pressed
  576.                 ns       -- number of selections in sl
  577.                 ini      -- the initial selection
  578.                 msgfun() -- the pointer to a user provided function for
  579.                             display the message
  580.                 sl       -- pointer to the structure of menu items.
  581.  
  582.                 struct MENU_S { /* as defined in NJSDK.H */
  583.                         char row;    /* display row */
  584.                         char col;    /* display col */
  585.                         char len;    /* display background len */
  586.                         char list;   /* the selection key in upper case */
  587.                         char *str;   /* menu string */
  588.                         char *msg;   /* message associated */
  589.                 } ;
  590.         
  591. Output:         (none)
  592. Return:         the number of selected item
  593. See also:       NJ_entry()
  594. Example:        
  595.         putmsg(char *str)
  596.         {
  597.                 NJ_puts(str, 20,20, 2,15);
  598.         }
  599.         struct MENU_S sl[2]={
  600.                 20,10, 10, 'Y', "Yes", "Confirm",
  601.                 21,10, 10, 'N', "No ", "quit"
  602.         }
  603.         main()
  604.         {
  605.             ....
  606.                 NJ_menu(11, 2, 14,4, 0, sl,2,0, putmsg);
  607.             ....
  608.         }
  609. __________________________________________________________________________
  610.  
  611. NJ_button       Select a list of options by pressing the button
  612.  
  613. Calling Syntax: int NJ_button(struct MENU_S *sl, int ns, int ini, int pressed)
  614.  
  615. Input:  pressed=0 -- mouse cursor will move the selection item without press
  616.                      the mouse button
  617.         pressed=1 -- mouse cursor will move the selection item only if mouse
  618.                      buttons are pressed
  619.         ns   -- number of selections in sl
  620.         ini  -- the initial selection
  621.         sl   -- pointer to the structure of menu items.
  622.  
  623.         struct MENU_S { /* as defined in NJSDK.H */
  624.                char row;     /* display row */
  625.                char col;     /* display col */
  626.                char len;     /* display background len */
  627.                char list;    /* the selection key in upper case */
  628.                char *str;    /* menu string */
  629.                char *msg;    /* message associated, not used by this function*/
  630.         } ;
  631.  
  632. Output:   (none)
  633. Return:   the number of selected item
  634. See also: NJ_menu()
  635. Example:
  636.         struct MENU_S sl[2]={
  637.                 {20,10, 10, 'Y', "Yes", " "},
  638.                 {21,10, 10, 'N', "No ", " "}
  639.         }
  640.         main()
  641.         {
  642.             ....
  643.                 NJ_button(sl,2,0,1);
  644.             ....
  645.         }
  646.  
  647. __________________________________________________________________________
  648.  
  649. NJ_entry        data entry routine
  650.  
  651. Calling Syntax: int NJ_entry(int Fcolor1, int Bcolor1, int Fcolor2,
  652.                         int Bcolor2, struct ENTRY_S *sl,int ns,int ini,
  653.                         int(*msgfun)(char *))
  654.  
  655. Input:          Fcolor1, Bcolor1 -- the foreground and background color
  656.                                     of normal text
  657.                 Fcolor2, Bcolor2 -- the foreground and background color
  658.                                     of high lighted text (0 - 15).
  659.                 ns       -- number of selections in sl
  660.                 ini      -- the initial selection
  661.                 msgfun() -- the pointer to a user provided function for
  662.                             display the message
  663.                 sl       -- pointer to the structure of menu items.
  664.  
  665.                 struct ENTRY_S {
  666.                     char row;           /* display row */
  667.                     char col;           /* display row */
  668.                     char len;           /* len of the  field */
  669.                     char type;          /* type of the field, not used*/
  670.                     char str[80];       /* str to hold field */
  671.                     char *msg;          /*message associated*/
  672.                 };
  673.  
  674.                 msgfun(char *msg) -- the pointer to a user provided
  675.                                      function for display the message.
  676.                       INPUT:  msg -- the string of message
  677.         
  678. Output:         sl -- the data entered are stored in sl[i].str.
  679. Return:         0 -- Normal return
  680.                 -1 - Data entry is cancelled by user
  681. See also:       NJ_menu
  682. Example:        
  683.         putmsg(char *str)
  684.         {
  685.                 NJ_puts(str, 20,20, 2,15);
  686.         }
  687.         struct ENTRY_S sl[2]={
  688.                 20,10, 10,0, " ", "Enter Your Name",
  689.                 21,10, 10,0, " ", "Enter you age"
  690.         }
  691.         main()
  692.         {
  693.             ....
  694.                 NJ_entry(11, 2, 14,4, sl,2,0, putmsg);
  695.             ....
  696.         }
  697. __________________________________________________________________________
  698.  
  699. NJ_dialog       data entry with push button and radio buttons
  700.  
  701. Calling Syntax: int NJ_dialog(int Fcol1,int Bcol1,int Fcol2,int Bcol2,
  702.                     int Fcol3, int Bcol3, struct DIALOG_S *sl,int ns,int ini,
  703.                     int(*DialogProc)(int, int), int(*msgfun)(char *));
  704.  
  705. Input:  Fcol1, Bcol1 -- the foreground and background color of normal text
  706.         Fcol2, Bcol2 -- the foreground and background color of data entry
  707.                         non-current item (0 - 15)
  708.         Fcol3, Bcol3 -- the foreground and background color of high lighted
  709.                         data entry item (0 - 15)
  710.  
  711.         ns   -- number of selections in sl
  712.         ini  -- the initial selection
  713.         sl   -- pointer to the structure of dialog items.
  714.  
  715.         struct DIALOG_S {
  716.             char row;           /* display row */
  717.             char col;           /* display row */
  718.             char len;           /* len of the  field */
  719.             char type;          /* type of the field:  0 - data entry */
  720.                                 /*                    -1 - push button */
  721.                                 /*                    -2 - radio button */
  722.             char radio;         /* store radio status*/
  723.             char str[80];       /* str to hold field value*/
  724.             char *msg;          /*message assorciated*/
  725.         };
  726.  
  727.         msgfun(char *msg) -- the pointer to a user provided function for
  728.                              display the message.
  729.               INPUT:  msg -- the string of message
  730.  
  731.         DialogProc(int k, int s) -- the pointer to a user provided function for
  732.                                     handling the dialog messages.
  733.                     INPUT:  k=-1 -- initialize dialog setting
  734.                             k=0  -- button number S has been pressed,
  735.                             k>0  -- a non-editing key has been pressed
  736.  
  737.                    Output:   -1 -- Cancel the dialog box
  738.                               0 -- End dialog and return to calling program
  739.                               1 -- Re-paint all entries
  740.  
  741.         NOTE: In DialogProc, user can access the information in DIALOG_S
  742.                      structure -- sl. See *****.C for example usage.
  743.  
  744. Output:  sl -- the data entered are stored in sl[i].str.
  745. Return:  0 -- Normal return, entry valid
  746.         -1 -- Data entry is cancelled by ESC or a push button.
  747. See also:     NJ_menu
  748. Example:
  749.         #include <stdio.h>
  750.         #include "njsdk.h'
  751.         #include "keys.h'
  752.  
  753.         struct ENTRY_S sl[4]={
  754.                 {10,10, 10,0,0 " ", "Enter Your Name"},
  755.                 {12,10, 10,0,0 " ", "Enter you age"},
  756.                 {15,10, 10,-1,0 "OK",     "Accept the input"},
  757.                 {15,13, 10,-1,0 "Cancel", "Quit the dialog"}
  758.         }
  759.  
  760.         int putmsg(char *str)
  761.         {
  762.                 NJ_puts(str, 20,20, 2,15);
  763.         }
  764.  
  765.  
  766.         int mydialogproc(int k, int s)
  767.         {
  768.                 if(k<0){
  769.                         if(s==2) return (0);      /* Ok     */
  770.                         else if(s==3) return(-1); /* cancel */
  771.                 }else if(k==PGUP){GetLastRecordFromDataBase();}
  772.                 }else if(k==PGDN){GetNextRecordFromDataBase();}
  773.                 return(1);
  774.         }
  775.  
  776.         main()
  777.         {
  778.             ....
  779.                 i=NJ_entry(15,1,11,2,14,4,sl,2,0,mydialogproc, putmsg);
  780.                 if(i<0)         /* Cancelled */
  781.                 else if(i>=0)   /* Ok       */
  782.             ....
  783.         }
  784. __________________________________________________________________________
  785.  
  786.  
  787. *       Printer Output  (Not included in trial version)
  788. __________________________________________________________________________
  789.  
  790. NJ_prt_init     Initialise printer driver
  791.  
  792. Calling Syntax: NJ_prt_init()
  793. Input:          (none)
  794. Return:         0  - Initialisation OK
  795.                 -1 - Initialisation failed
  796. See also:       NJ_init()
  797. Example:        
  798.         main(int argc, char **argv)
  799.         {
  800.                 NJ_init(argv[0]);
  801.                 ....
  802.                 NJ_prt_init()
  803.                 NJ_prts("CHINESE string");
  804.                 ....
  805.                 NJ_end();
  806.         }
  807. __________________________________________________________________________
  808.  
  809. NJ_prt_end     end of the printing
  810.  
  811. Calling Syntax: NJ_prt_end()
  812. Input:          (none)
  813. Return:         0  - Ok
  814.                 -1 - failed
  815. See also:       NJ_prt_init()
  816. Example:        
  817.         main(int argc, char **argv)
  818.         {
  819.                 NJ_init(argv[0]);
  820.                 ....
  821.                 NJ_prt_init()
  822.                 NJ_prts("CHINESE string");
  823.                 NJ_prt_end()
  824.                 ....
  825.                 NJ_end();
  826.         }
  827. __________________________________________________________________________
  828.  
  829. NJ_fontsize     Change the size of Chinese characters.
  830.  
  831. Calling Syntax: int NJ_fontsize(int size)
  832. Input:          size - size of printed Chinese chars (=1 or 2)
  833. Output:         (none)
  834. Return:         (none)
  835. See also:       NJ_prts()
  836. Example:        
  837.         NJ_fontsize(2);
  838.         .....
  839. __________________________________________________________________________
  840.  
  841. NJ_setmargin    Set Margins and line spacing
  842.  
  843. Calling Syntax: NJ_setmargin(int l, int r, int t, int b, int s)
  844. Input:          l = left margin in number of Chinese characters
  845.                 r = right margin in number of Chinese characters
  846.                 t = top margin in number of lines (1 line = 30 dots)
  847.                 b = bottom margin in number of lines (1 line = 30 dots)
  848.                 s = line spacing in number of pixels/dots
  849. Return:         0 - Ok;  -1 -Failed.
  850. See also:       NJ_linefeed()
  851. Example:        
  852.         NJ_setmargin(5,5,2,6,12);
  853.         ....
  854. __________________________________________________________________________
  855.  
  856. NJ_prts         Print a string to printer.
  857.  
  858. Calling Syntax: int NJ_puts(char str)
  859. Input:          str -- the string to display (ascii, Chinese or mix of them)
  860. Output:         (none)
  861. Return:         0  - OK
  862.                 -1 - Faild.
  863. See also:       NJ_puts()
  864. Example:        
  865.         NJ_prts("CHINESE Chars");
  866.         .....
  867. __________________________________________________________________________
  868.  
  869. NJ_linefeed     Feed the printer by number of pixels/dots
  870.  
  871. Calling Syntax: NJ_linefeed(int lines)
  872. Input:          lines -- the number of pixels/lines to feed
  873. Return:         (none)
  874. See also:       NJ_formfeed()
  875. Example:        
  876.         NJ_linefeed(5);
  877.         ....
  878. __________________________________________________________________________
  879.  
  880. NJ_formfeed     Feed the printer paper to next page
  881.  
  882. Calling Syntax: NJ_formfeed()
  883. Input:          (none)
  884. Return:         (none)
  885. See also:       NJ_linefeed()
  886. Example:        
  887.         NJ_formfeed(5);
  888.         ....
  889.  
  890. ============================================================================
  891. END of NJSDK.TXT
  892.